The complete program is given below.
Translating the polynomial
The next statement, that writes out the answer uses "+" to concatenate Strings. Remember that doubles are converted to Strings automatically when you use "+" with both a double and a String.
import java.io.*; class evalPoly { public static void main (String[] args ) throws IOException { BufferedReader userin = new BufferedReader(new InputStreamReader(System.in) ); String xChars; // character version of x, from the user double x; // a value to use with the polynomial double result; // result of evaluating the polynomial at x String response = "y"; // "y" or "n" while ( response.equals( "y" ) ) { // Get a value for x. System.out.println("Enter a value for x:") ; xChars = userin.readLine() ; x = ( Double.valueOf( xChars ) ).doubleValue(); // Evaluate the polynomial. result =7*x*x*x - 3*x*x + 4*x - 12; // Print out the result. System.out.println("The value of the polynomial at x = " + x + " is :" + result + "\n" ) ; // Ask the user if the program should continue. System.out.println("continue (y or n)?"); response = userin.readLine(); } } }